
#include "S_23_FavoriteTypeData_doGet.h"
#include "mi_iid_define.h"
#include "property_decoder.h"
#include "section_define.h"
#include "main.h"

/**
 * 格式: property_value_new_string(字符串)　
 * 取值: 字符串，没有限制取值范围
 */
static void P_23_1_UserDefinedMode_doGet(property_operation_t *o)
{
#if 	PROPERTY_TYPE
	property_value_new_string(&o->value,"hello");
#else	
	o->value.format = PROPERTY_FORMAT_STRING;
	strncpy(o->value.data.string.value, "hello", strlen("hello")); // TODO: 这里需要读到属性真正的值
	o->value.data.string.length = strlen("hello"); 
#endif
}

/**
 * 格式: property_value_new_string(字符串)　
 * 取值: 字符串，没有限制取值范围
 */
static void P_23_2_RecommendMode_doGet(property_operation_t *o)
{
#if 	PROPERTY_TYPE
	property_value_new_string(&o->value,"hello");
#else	
	o->value.format = PROPERTY_FORMAT_STRING;
	strncpy(o->value.data.string.value, "hello", strlen("hello")); // TODO: 这里需要读到属性真正的值
	o->value.data.string.length = strlen("hello"); 
#endif
}

/**
 * 格式: property_value_new_boolean(true 或 false)　
 * 取值: true 或　false
 */
static void P_23_3_AlwaysFavoriteOn_doGet(property_operation_t *o)
{
	InDoorBusReg RegSection1 = {0};	
#if 	PROPERTY_TYPE
	RegSection1.V8 = GetPbsRegValue(0x05);
//	if(RegSection1.BIT.bit7)
	{
		property_value_new_boolean(&o->value,RegSection1.BIT.bit6);
	}	
	
#else	
	o->value.format = PROPERTY_FORMAT_BOOLEAN;
    o->value.data.boolean.value = true;  // TODO: 这里需要读到属性真正的值
#endif
    
}

void S_23_FavoriteTypeData_doGet(property_operation_t *o)
{
    switch (o->piid)
    {
        case PIID_23_1_UserDefinedMode:
            P_23_1_UserDefinedMode_doGet(o);
            break;

        case PIID_23_2_RecommendMode:
            P_23_2_RecommendMode_doGet(o);
            break;

        case PIID_23_3_AlwaysFavoriteOn:
            P_23_3_AlwaysFavoriteOn_doGet(o);
            break;

        default:
            o->code = OPERATION_ERROR_VALUE;
            break;
    }
}
